﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JzSport.Model
{
    public class ActivityImageRepository
    {
        private JzSportDbContext _dbContext;

        public ActivityImageRepository(JzSportDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        public List<ImageResource> GetImages(Guid activityId)
        {
            return _dbContext.Database.SqlQuery<ImageResource>(@"SELECT IR.* FROM ImageResource AS IR INNER JOIN ActivityImage AS AI ON AI.ImageId = IR.Id WHERE AI.ActivityId = {0}", activityId).ToList();
        }
    }
}
